<?php
class i18n{
	protected $data;
	static $handle;
	function __construct(){
		session_start();
		//加载
		if($_SESSION["lan"]=="en"){
			$this->data=include dirname(__FILE__).'/../Lang/en.conf.php';
		}else{
			$this->data=include dirname(__FILE__).'/../Lang/zh-cn.conf.php';
		}
	}
	public static function load(){
		if(!self::$handle){
			self::$handle=new i18n();
		}
		return self::$handle;
	}
	public function trans($key){
		if(array_key_exists($key,  $this->data)){
			return $this->data[$key];
		}else{
			return $key;
		}
		
	}
}